package com.squirrel.common.controller;

import com.squirrel.common.annotation.AuthToken;
import com.squirrel.common.entity.UserComment;
import com.squirrel.common.param.userComment.AddRelationshipParam;
import com.squirrel.common.param.userComment.RelationshipParam;
import com.squirrel.common.response.ResponseResult;
import com.squirrel.common.response.ResponseResultUtils;
import com.squirrel.common.service.UserCommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * UserCommentController 用户评论关系控制器
 * </p>
 *
 * @author 关远键
 * @since 2021/11/11 16:06
 */
@RestController
@RequestMapping("/api/user-comment")
@Api(tags = "用户评论关系控制器")
public class UserCommentController {

    @Autowired
    private UserCommentService ucService;

    @GetMapping("/getRelationship")
    @ApiOperation("用户评论关系")
    public ResponseResult<UserComment> getRelationship(RelationshipParam param) {
        return ResponseResultUtils.success(ucService.getRelationship(param));
    }

    @PostMapping("/addRelationship")
    @ApiOperation("添加关系（点赞或踩它）")
    @AuthToken
    public ResponseResult<Integer> addRelationship(AddRelationshipParam param) {
        return ResponseResultUtils.success(ucService.addRelationship(param));
    }

}
